/*
 * @Author: xuni xuni@sjgtw.com
 * @Date: 2023-05-26 09:21:13
 * @LastEditors: xuni xuni@sjgtw.com
 * @LastEditTime: 2023-06-05 09:03:26
 * @FilePath: \railway-work-cost-platform-admin\src\utils\jsencrypt.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

// const pubKey =
//   'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClDvYy8/9TtotqQsElqvGaggz/sjvFi3DHd2PJq3L1MEZJMGhx65vFiClAMfvqY/UiN7Uel9JQeSVCv7z33c6A5gqPSzWyZ8Fmg2CYwJrahYCnW8mkIDqdLsduKYy4UN4gds62bsiylkVeb8tzKOkriFVX3514Von6XFNHQPM5iwIDAQAB'
const pubKey =
  'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClDvYy8/9TtotqQsElqvGaggz/sjvFi3DHd2PJq3L1MEZJMGhx65vFiClAMfvqY/UiN7Uel9JQeSVCv7z33c6A5gqPSzWyZ8Fmg2CYwJrahYCnW8mkIDqdLsduKYy4UN4gds62bsiylkVeb8tzKOkriFVX3514Von6XFNHQPM5iwIDAQAB'
// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(pubKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}
